package com.deyuanyun.pic.pipe.service.impl;

import com.deyuanyun.pic.pipe.controller.dto.*;
import com.deyuanyun.pic.pipe.domain.*;
import com.deyuanyun.pic.pipe.domain.bo.*;
import com.deyuanyun.pic.pipe.mapper.PipeLineElementMapper;
import com.deyuanyun.pic.pipe.mapper.dao.PipeLineMgrDao;
import com.deyuanyun.pic.pipe.service.PipeMgrService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * “管道数据查询” 服务接口实现类
 *
 * @author huanglw
 * @date  2016-10-11
 *
 * History: [修改人][时间][修改描述]
 */
@Service
public class PipeMgrServiceImpl implements PipeMgrService {

    @Resource
    private PipeLineMgrDao pipeLineMgrDao;
    @Resource
    private PipeLineElementMapper pipeLineElementMapper;

    @Override
    public Page<PipeSegmentInfoBO> queryPipeSegmentInfo(PipeSegmentInfoQuery pipeSegmentInfoQuery) {
        return pipeLineMgrDao.queryPipeSegmentInfo(pipeSegmentInfoQuery);
    }

    @Override
    public List<PipeLineStatisticsBO> statistics(PipeBaseQuery pipeBaseQuery) {
        return pipeLineMgrDao.statistics(pipeBaseQuery);
    }

    @Override
    public PipeLineElement findPipeLineElement(String elementId) {
        PipeLineElementExample example = new PipeLineElementExample();
        example.createCriteria().andDeletedEqualTo(Short.valueOf("0")).andElementTypeEqualTo("VALVEROOM").andElementIdEqualTo(elementId);
        List<PipeLineElement> list = pipeLineElementMapper.selectByExample(example);
        if (list != null && list.size() >= 1){
            return list.get(0);
        }
        return null;
    }

    @Override
    public Page<ValveRoomBO> queryValveRoom(ValveRoomQuery valveRoomQuery) {
        return pipeLineMgrDao.queryValveRoom(valveRoomQuery);
    }

    @Override
    public Page<Valve> queryValve(ValveQuery valveQuery) {
        return pipeLineMgrDao.queryValve(valveQuery);
    }

    @Override
    public Page<SteelPipe> querySteelPipe(PipeBaseQuery pipeBaseQuery){
        return pipeLineMgrDao.querySteelPipe(pipeBaseQuery);
    }

    @Override
    public Page<Tee> queryTee(TeeQuery teeQuery) {
        return pipeLineMgrDao.queryTee(teeQuery);
    }

    @Override
    public Page<Tap> queryTap(PipeBaseQuery pipeBaseQuery) {
        return pipeLineMgrDao.queryTap(pipeBaseQuery);
    }

    @Override
    public Page<Closure> queryClosure(PipeBaseQuery pipeBaseQuery) {
        return pipeLineMgrDao.queryClosure(pipeBaseQuery);
    }

    @Override
    public Page<Reducer> queryReducer(PipeBaseQuery pipeBaseQuery) {
        return pipeLineMgrDao.queryReducer(pipeBaseQuery);
    }

    @Override
    public Page<PiggingStructure> queryPiggingStructure(PiggingStructureQuery piggingStructureQuery) {
        return pipeLineMgrDao.queryPiggingStructure(piggingStructureQuery);
    }

    @Override
    public Page<Cross> queryCross(PipeBaseQuery pipeBaseQuery) {
        return pipeLineMgrDao.queryCross(pipeBaseQuery);
    }

    @Override
    public Page<PipeCross> queryPipeCross(PipeCrossQuery pipeCrossQuery) {
        return pipeLineMgrDao.queryPipeCross(pipeCrossQuery);
    }

    @Override
    public Page<Identification> queryIdentification(IdentificationQuery identificationQuery) {
        return pipeLineMgrDao.queryIdentification(identificationQuery);
    }

    @Override
    public Page<Protection> queryProtection(ProtectionQuery protectionQuery) {
        return pipeLineMgrDao.queryProtection(protectionQuery);
    }

    @Override
    public Page<TransformMedia> queryTransformMedia(TransformMediaQuery transformMediaQuery) {
        return pipeLineMgrDao.queryTransformMedia(transformMediaQuery);
    }
}
